#include "SavingsAccount.h"

double SavingsAccount::annualInterstRate = 0.03;

void SavingsAccount::calculateMonthlyInterst ()
{
    savingsBalance += savingsBalance * annualInterstRate / 12;
}

void SavingsAccount::modifyInterstRate (double r)
{
    annualInterstRate = (r > 0.0 && r < 1.0 ? r : annualInterstRate);
}

void SavingsAccount::printBalance () const
{
    ios::fmtflags old = cout.flags ();
    cout.precision (2);
    cout.setf (ios::fixed);

    cout << "$" << savingsBalance;

    cout.flags (old);
}
